{% extends "base.html" %}

{% block title %}log-review-platform{% endblock %}

{% block app_content %}
    <div class="page-header">
        <h3>openEuler Hardware Compatibility Test</h3>
        <br>
    </div>

    <div class="page-header">
        <table class="table table-striped table-hover">
            <thead>
            <th colspan="2">Environment</th>
            </thead>
            <tbody>
            {% for key in info %}
                <tr>
                    <td width="50%">{{ key }}</td>
                    <td>{{ info.get(key) }}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>

    <div class="page-header">
        <form method="post"  action="">
            <table class="table table-striped table-hover">
                <thead>
                <th>Testcase</th>
                <th>Device</th>
                <th>Result</th>
                <th>Review Result</th>
                <th>Review comments</th>
                </thead>
                {% for d in results %}
                    <tr>
                        {% set int = d.get("device").get("INTERFACE", "") %}

                        {% if int %}
                            {% set testcase = d.get("name") + "-" + int %}
                        {% else %}
                            {% set testcase = d.get("name") %}
                        {% endif %}

                        {% if d.get("run") %}
                            {% set result = d.get("status") %}
                            {% set rev_result = d.get("review_result","") %}
                            {% set rev_com = d.get("review_comments","") %}
                        {% else %}
                            {% set result = "" %}
                        {% endif %}
                        <td>{{ testcase }}</td>
                        <td>{{ int }}</td>
                        <td>
                            <a href="/results/{{ manu }}/{{ hardware }}/{{ taskid }}/{{ job }}/logs/{{ testcase }}">{{ result }}</a>
                        </td>
                        <td>
                            {% if d.get("run") %}
                                <select id="rev_res", name="rev_res">
                                    {% for item in rev_options %}
                                        {% if item==rev_result %}
                                            <option value="{{item}}"  selected>{{item}}</option>
                                        {% else %}
                                            <option value="{{item}}">{{item}}</option>
                                        {% endif %}
                                    {% endfor %}
                                </select>
                            {% endif %}
                        </td>
                        <td>
                            {% if result %}
                                <input type="textarea" name="rev_comment" value="{{ rev_com }}">
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
                <tr>
                    <td height="38" colspan="5" align="center">
                        {{ form.csrf_token }}
                        {{ form.submit }}
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
{% endblock %}
